﻿using System;
using System.Collections.Generic;
using System.Text;

namespace unitlib
{
    public readonly struct Unit_N3mm : IUnit
    {
        public double Value { get; }
        public string Unit => throw new NotImplementedException();

        public string LatexUnit => throw new NotImplementedException();

        public Unit_N3mm(double value) { Value = value; }
        public Unit_N3mm Round(int digits) => new Unit_N3mm(Math.Round(Value, digits));
        //数值与字符串转换
        public override string ToString() => Value.ToString();
        public static explicit operator Unit_N3mm(double value) => new Unit_N3mm(value);
        public static explicit operator double(Unit_N3mm value) => value.Value;
        public static implicit operator Unit_N3mm(string value) => new Unit_N3mm(value.Parse());
        //比较运算
        public static bool operator ==(Unit_N3mm left, Unit_N3mm right) => left.Equals(right);
        public static bool operator !=(Unit_N3mm left, Unit_N3mm right) => !left.Equals(right);
        public override bool Equals(object obj) => obj is Unit_N3mm other && other.Value == Value;
        public override int GetHashCode()
        {
            unchecked
            {
                return GetType().GetHashCode() * 31 + Value.GetHashCode();
            }
        }
        //常规运算
        public static Unit_N3mm operator +(Unit_N3mm left, Unit_N3mm right) => new Unit_N3mm(left.Value + right.Value);
        public static Unit_N3mm operator -(Unit_N3mm left, Unit_N3mm right) => new Unit_N3mm(left.Value - right.Value);
        public static Unit_N3mm operator *(Unit_N3mm left, UnitValue right) => new Unit_N3mm(left.Value * right.Value);
        public static Unit_N3mm operator *(UnitValue left, Unit_N3mm right) => new Unit_N3mm(left.Value * right.Value);
        public static Unit_N3mm operator /(Unit_N3mm left, UnitValue right) => new Unit_N3mm(left.Value / right.Value);
        public static UnitValue operator /(Unit_N3mm left, Unit_N3mm right) => new UnitValue(left.Value / right.Value);
        //新增运算  
    }
}
